1. Field of the Invention
The present invention relates to an apparatus and a method for writing data to a recording medium, and more particularly, to an apparatus and a method for writing data in a buffer to a recording medium according to a command from a higher-level device.
2. Background Information
A tape drive that writes data to a tape medium, such as a magnetic tape, is capable of returning a warning message to a host computer (hereinafter referred to as “host”) when the end of the tape medium approaches. In general, the tape drive temporarily stores data sent from the host in a buffer memory (hereinafter referred to as “buffer”) and writes the data stored in the buffer to the tape medium with predetermined timing. The tape drive is capable of returning a warning message to the host so that all the data stored in the buffer can be written to the tape medium.
There have been discussions about at which point on the tape medium a warning message should be issued. It is known in the prior art, that the number of data sets stored in the buffer memory is compared with information about a current writing position on the tape so as to determine whether to inform the host of the logical end of tape (LEOT). Other prior art attempts include a technique wherein a recording capacity of an unrecorded area can be calculated as an amount of data and a technique wherein a remaining capacity of a magnetic tape can be determined in consideration of a data compression ratio.
Accordingly, an object of the invention is allow data in a buffer to be completely written to a recording medium while maintaining a high level of recording efficiency on the recording medium.